package com.liu.netty.entity;


import com.fasterxml.jackson.annotation.JsonIdentityInfo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;


import javax.persistence.*;
import java.util.*;

@Entity

@Getter
@Setter
@NoArgsConstructor
@Table(name = "sx_driver")
@ApiModel(value = "driver",description = "设备对象")
//@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class Driver {

    @Id
    private String id; // 设备ID

    private String address; // 设备地址

    private String objectAddress; //设备编号

    private String name; // 设备名称


    private String  type; // 设备类型

    private String areaId;  // 设备归属地，这里填写 id

    private String status; // 设备状态

    private  String powerStatus; //设备电源状态



    @OneToMany(mappedBy = "driver",fetch = FetchType.EAGER)
//    @JsonIgnoreProperties(value = {"driver"})
    @JsonManagedReference
    private List<Senor> senors = new ArrayList<>() ;



}
